#include "CommandList.h"

void CommandList::execute() {
	if( _listType == LIST_ALL ) {
		LogicList::getInstance().listAllTasks();
	} else if( _listType == LIST_SEARCH_TERM ) {
		LogicList::getInstance().listTaskBySearchTerm( _searchTerm );
	} else if( _listType == LIST_DAY ) {
		LogicList::getInstance().listTaskByDay( _time );
	} else if( _listType == LIST_WEEK ) {
		LogicList::getInstance().listTaskNextWeek( _time );
	} else if( _listType == LIST_MONTH ) {
		LogicList::getInstance().listTaskByMonth( _time );
	} else if( _listType == LIST_DONE ) {
		LogicList::getInstance().listTaskByDone( _done );
	} else {
		// idle state
		// maintain display's view
	}
}

CommandList::CommandList( ListType listType ) {
	_listType = listType;
}

CommandList::CommandList( ListType listType, string searchTerm ) {
	_listType = listType;
	_searchTerm = searchTerm;
}

CommandList::CommandList( ListType listType, ptime time ) {
	_listType = listType;
	_time = time;
}

CommandList::CommandList( ListType listType, bool done ) {
	_listType = listType;
	_done = done;
}